function zoomRange(num) {
  switch (true) {
    case num <= 2:
      return 10
    case num > 2 && num <= 4:
      return 9.3
    case num > 4 && num <= 6:
      return 8
    case num > 6 && num <= 8:
      return 7.8
    case num > 8 && num <= 12:
      return 7.1
    case num > 12 && num <= 22:
      return 6.2
    case num > 22 && num <= 25:
      return 6.1
    case num > 25:
      return 5.8
    default:
      throw Error('缩放差值错误，请检查函数zoomRange')
  }
}

function getOpacityNum() { // 取2-7之间的随机数
  let arr = []
  let randomNum = Math.abs(Math.floor(Math.random() * 10 - 4))
  for (let i = 2; i < 8; i++) {
    arr.push(i)
  }
  let opacityNum = arr[randomNum] / 10
  return opacityNum
}

function getRandomNum() {
  let curnNum = Math.floor(Math.random() * 3) + 1
  if (curnNum < 1) {
    this.getRandomNum()
  }
  return curnNum
}

export {
  zoomRange,
  getOpacityNum,
  getRandomNum
}
